<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>20210902124邵文杰作业2</title>
    <script src="node_modules\vue\dist\vue.js"></script>
</head>
<body>
  <div id="app">
    <p>初始字符串1: {{ a1 }}</p>
    <p>应用computed反向字符串: {{ ra1 }}</p>
    <p>初始字符串2: {{ a2 }}</p>
    <p>应用methods反向字符串: {{ ra2() }}</p>
  </div>
      
<script>
    var vm = new Vue({
        el: '#app',
        data: {
            a1: "happy",
            a2: "lucky"
        },
        computed: {
            ra1() {
                return this.a1.split('').reverse().join('');
            }
        },
        methods: {
            ra2() {
                return this.a2.split('').reverse().join('');
            }
        }
    });
</script>
  
</body>
</html>
